package com.akw.boot3.features;

import com.akw.boot3.features.bean.Cat;
import com.akw.boot3.features.bean.Dog;
import com.akw.boot3.features.bean.Pig;
import com.akw.boot3.features.bean.Sheep;
import com.akw.boot3.starter.robot.RobotAutoConfiguration;
import com.akw.boot3.starter.robot.annotation.EnableRobot;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;

@Slf4j
@SpringBootApplication
//@Import({RobotAutoConfiguration.class})
//@EnableRobot
public class Boot306FeaturesApplication {

    public static void main(String[] args) {
        // SpringApplication: Boot应用的核心API入口
//        ConfigurableApplicationContext ctx = SpringApplication.run(Boot306FeaturesApplication.class, args);
        SpringApplication springApplication = new SpringApplication(Boot306FeaturesApplication.class);

        springApplication.setBannerMode(Banner.Mode.CONSOLE);

        ConfigurableApplicationContext ctx = springApplication.run(args);
        try {
            Cat cat = ctx.getBean(Cat.class);
            log.info("组件cat: {}", cat);
        } catch (Exception e) {
        }

        try {
            Dog dog = ctx.getBean(Dog.class);
            log.info("组件dog: {}", dog);
        } catch (Exception e) {
        }

        try {
            Pig pig = ctx.getBean(Pig.class);
            log.info("组件pig: {}", pig);
        } catch (Exception e) {
        }

        try {
            Sheep sheep = ctx.getBean(Sheep.class);
            log.info("组件sheep: {}", sheep);
        } catch (Exception e) {
        }
    }

}
